﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using DataAccess.Object;
using System.Data;

namespace Business
{

    public class DonHangBUS
    {
        DonHangDAO dhDAO = new DonHangDAO();
        public DataTable DS_DON_HANG()
        {
            return dhDAO.DS_DON_HANG();
        }
        public void themDH(DonHangOB dh)
        {
            dhDAO.themDonHang(dh);
        }
        public void themDH_SP(DH_SPOB dh_sp)
        {
            dhDAO.themDH_SP(dh_sp);
        }

        public void suaDH_SP(DH_SPOB dh_sp)
        {
            dhDAO.suaDH_SP(dh_sp);
        }
        public DataTable DonHang_By_Id(string id)
        {
            return dhDAO.DonHang_By_Id(id);
        }
        public void suaDH(DonHangOB dh)
        {
            dhDAO.suaDonHang(dh);
        }
        public DataTable getParam(string id)
        {
            return dhDAO.LayParam(id);
        }
        public void xoaDH_SP(string id)
        {
            dhDAO.xoaDH_SP(id);
        }
        public DataTable timKiem(string madh, string tenng, string sdt)
        {
            string where = "";
            string conditon = "";
            string str = "";
            if (madh != "")
            {
                str += conditon + " ma_hd like '%" + madh + "%' ";
                conditon = " and ";
            }

            if (tenng != "")
            {
                str += conditon + " US.TAIKHOAN_NV like '%" + tenng + "%' ";
                conditon = " and ";
            }
            if (sdt != "")
            {
                str += conditon + " SDT_KH like '%" + sdt + "%' ";
                conditon = " and ";
            }
            if (str.Length > 0)
            {
                where = " where " + str;
            }
           return dhDAO.timKiem(where);
        }
        public void xoaDH(string id)
        {
            dhDAO.xoaDH(id);
        }
    
    }
}
